<script>
	let obj = {
		name: 'zhangsan',
	}
	// const map = new Map();
	// map.set(obj, 'value');
	// obj = null;
	// console.log(map) // Map(1) { {…} => 'value' } 依然有值

	const weakmap = new WeakMap();
	weakmap.set(obj, 'value');
	obj = null;
	console.log(weakmap) // WeakMap {} 无值，被垃圾回收
</script>